package org.quipu.client;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Widget;
import org.quipu.client.events.AppEventBus;
import org.quipu.client.events.AppEventListener;
import org.quipu.client.events.ErrorEvent;

public abstract class AppEventWidget extends AppEventCachedComponent implements AppEventListener {

    public AppEventWidget(AppEventBus eventBus, AppCache cache) {
        super(eventBus, cache);
    }

    public abstract Widget getWidget();

    protected void fireError(String message) {
        getEventBus().fireEvent(new ErrorEvent(this, message));
    }

    protected void showWarning(String message) {
        Window.alert(message);
    }
}
